package 反射;import java.lang.reflect.Method;import java.lang.reflect.Type;public class Test {    public static void main(String[] args) throws Exception {        //ReflectCase rc = new ReflectCase();        //Class<?> classCase = rc.getClass();        Class<?> c = ReflectCase.class;        System.out.println("类名:" + c);        // 获得类的方法        Method[] method = c.getMethods();        Type TypeParameter = null;        int i = 0;        for (Method m : method) {            i++;            if (m.getGenericParameterTypes().length != 0) {                TypeParameter = m.getGenericParameterTypes()[0];            }            System.out.println(i + "方法名称:" + m.getName() + "->方法返回的类型:" + m.getReturnType() + "->形参类型:" + TypeParameter);        }        //反射add方法体        Method m2 = c.getMethod("add", new Class[]{String.class, String.class});        m2.invoke(c.newInstance(), "1", "2");    }}